package com.youku.baseUI
{
   import flash.text.TextField;
   import flash.text.TextFormat;
   
   public class YoukuTextField extends TextField
   {
      
      public function YoukuTextField() {
         super();
         this._privateTf = new TextField();
         this._stTf = new TextField();
         this._thisY = 0;
         this._fontOffset = 0;
         this._isYahei = false;
      }
      
      private var _privateTf:TextField;
      
      private var _stTf:TextField;
      
      private var _thisY:Number;
      
      private var _fontOffset:Number;
      
      private var _isYahei:Boolean;
      
      override public function set defaultTextFormat(param1:TextFormat) : void {
         this._privateTf.defaultTextFormat = param1;
         this._privateTf.text = "测试";
         this._isYahei = this.checkIsYahei(param1.font);
         super.defaultTextFormat = param1;
         this._stTf.defaultTextFormat = new TextFormat(null,param1.size,param1.color);
         this._stTf.text = "测试";
      }
      
      override public function set y(param1:Number) : void {
         var _loc2_:Number = (this._isYahei) && this._privateTf.textHeight == this._stTf.textHeight?-1:0;
         super.y = param1 - (this._privateTf.textHeight - int(this._privateTf.getTextFormat().size)) + _loc2_ + this._fontOffset;
         this._thisY = param1;
      }
      
      override public function get y() : Number {
         return this._thisY;
      }
      
      public function set fontHoffset(param1:Number) : void {
         if(!this._isYahei || !(this._privateTf.textHeight == this._stTf.textHeight))
         {
            return;
         }
         this._fontOffset = param1;
         this.y = this._thisY;
      }
      
      private function checkIsYahei(param1:String) : Boolean {
         return param1 == "微软雅黑" || param1 == "Microsoft YaHei";
      }
   }
}
